<?php

namespace app\admin\controller\miniform;

use app\admin\model\miniform\Student;
use app\common\controller\Backend;
use think\Request;

class School extends Backend
{

    protected $model = null;
    protected $searchFields = 'id,name';

    public function _initialize()
    {
        parent::_initialize();
        $this->model = new \app\admin\model\miniform\School;
    }
    
    /**
     * 编辑
     */
    public function edit($ids = null)
    {
        if ($this->request->isPost()) {
            $request = Request::instance();
            $meal_status = $request->param('row.meal_status');
            $meal_type = $request->param('row.meal_type');
            //更新学生报餐状态
            $student = new Student();
            $student->save([
                'meal_on'  => $meal_status,
                'meal_set'  => $meal_type,
            ],['school_id' => $ids]);
        }
        return parent::edit($ids);
    }

}
